import { requestClient } from '#/api/request';

export namespace Sn {
  export interface Params {
    attr1: null;
  }
  export interface Row {
    searchValue: null;
    createBy: null;
    createTime: null;
    updateBy: null;
    updateTime: null;
    remark: null;
    params: Params;
    snId: null;
    snCode: null;
    itemId: number;
    itemCode: string;
    itemName: string;
    specification: null;
    unitOfMeasure: null;
    unitName: null;
    batchCode: null;
    workorderId: null;
    workorderCode: null;
    inputTime: null;
    workstationId: null;
    snNum: number;
    genDate: Date;
    attr2: null;
    attr3: null;
    attr4: null;
    ids: string;
    attr1: boolean | null | string;
  }
  export interface GetListParams {
    pageNum: number;
    pageSize: number;
  }
  export interface GetListReturn {
    total: number;
    rows: Row[];
    code: number;
    msg: string;
  }
}

// 获取列表
export const getSnTableList = (params: Sn.GetListParams) =>
  requestClient.get<Sn.GetListReturn>('/mes/wm/sn/listSn', {
    params,
  });

// 增加
export const addSn = (data: Sn.Row) =>
  requestClient.post<Sn.GetListReturn>('mes/wm/sn', data);

// 删除
export const deleteSn = (ids: string) =>
  requestClient.delete<Sn.GetListReturn>(`/mes/wm/sn/remove/${ids}`);
